ac.buff('预警机制'){
    show_effect = function(self,target)
        local unit = self.owner
        local player = target.owner
        local handle = player.handle
        if player:is_self() then
            self.effect:set_visible(true)
        end
        if self.effect[handle] then
            self.effect[handle]:remove()
        end
        self.effect:set_scale((unit:get('攻击距离')) / (512 - unit:get_collision()))
        self.effect[handle] = ac.wait(1500,function()
            if player:is_self() then
                self.effect:set_visible(false)
            end
        end)
    end,
    on_add = function(self)
        local unit = self.owner
        self.effect = unit:get_point():add_effect([[range_circle.mdl]])
        self.effect:set_color(100,0,0)
        self.effect:set_visible(false)
        self:gc(unit:event '单位-攻击'(function(_,_,target)
            self:show_effect(target)
        end))
        self:gc(unit:event '单位-被攻击'(function(_,_,target)
            self:show_effect(target)
        end))
    end
}


ac.buff('自动仇恨'){
    on_add = function(self)
        local hero = self.owner
        local player = hero.owner_player
        local source = player.hero
        hero:issue_order('attack',source)
        self:gc(source:event '英雄-开始复活'(function()
            hero:issue_order('attack',ac.base_point)
            self.open = true
        end))
        self:gc(ac.loop(100,function()
            if self.open and not source:find_buff('假死复活') then
                hero:issue_order('attack',source)
                self.open = nil
            end
        end))
    end,
}